package com.demo11.d17_03.HalfClose;

import java.util.concurrent.*;

/**
 * @Author: root
 * @Date: 2018/12/5 18:09
 */
public class Test {
    public static void main(String[] args) throws Exception {
        ExecutorService ex = Executors.newSingleThreadExecutor();
        Future<Integer> f = ex.submit(new MyCallable(5));
        System.out.println(f.get());
        ex.shutdown();
    }
}

class MyCallable implements Callable<Integer> {
    private int num;

    public MyCallable() {

    }

    public MyCallable(int num) {
        this.num = num;
    }

    @Override
    public Integer call() throws Exception {
        return num;
    }
}